// JORGE FERNANDO GOMEZ
// 1259371
// 189631
// LEC A1
// MARTIN MÜLLER
// D02
// YANG LIU


#ifndef FIGSTACK_H
#define FIGSTACK_H 1

#define MAXLEN_FIG      128

#include <string.h>
#include "memwatch.h"

/* Struct to store figure names, and each
 * figure's properties. */
struct Properties  {
    char figureName[MAXLEN_FIG+1];

    double x, y;
    double *dx, *dy;
    
    int drawCount;
    int isdefined;
};

/* General struct to store figures. */
typedef struct {
    struct Properties * figProperties;

    int currSize;
    int figureCount;
} FigStack;



/* FUNCTION PROTOTYPES */

/* Initializes a figure stack. */
void initstack ( FigStack * Figures, int length );

/* Adds space for a new figure in the stack. */
void addFig ( FigStack * Figures, char * localFigName );

/* Initializes a figure. */
void initfig ( FigStack * Figures, char * figName );

/* Updates information in Figures using parameters found in string. */
void updatefig ( char * string, FigStack * Figures, int position, int type );

/* Adds space for new draw commands. */
void plusOneDraw ( FigStack * Figures, int position );

/* Retrieves the index of nameString inside Figures. */
int getFigIndex ( char * nameString, FigStack * Figures );

/* Finds if nameString exists inside Figures structure. */
int figexists ( char * nameString, FigStack * Figures );

/* Resets memory in Figures at position to reset. */
void clearfig ( FigStack * Figures, int position, double reset );

/* Adds space for more figures in the stack. */
void extendFigStack ( FigStack * Figures );

/* Frees memory used by the stack. */
void destroyFigStack ( FigStack * Figures );

#endif /* End of include guard: FIGSTACK_H */
